<template>
	<div class="zh-select-input">
    <zh-input v-model="queryParam.searchText" :delay="1000" placeholder="请输入查询内容" :suffix-icon="Search" >
      <template #prepend>
        <zh-select label="组织类型" placeholder="组织类型" :dropdownMatchSelectWidth="false" :options="dictData.orgType" v-model="queryParam.orgType"></zh-select>
      </template>
      </zh-input>
    <zh-tree
      ref="orgTreeRef"
      :showSearch="false"
      funcCode="org0008"
      :nodeLevel="1"
      moveFuncCode="org0011"
      :expand-on-click-node="false"
      :lazy="true"
      :queryParam="queryParam"
      node-key="key"
      :height="isTagsview ? `calc(100vh - 171px)` : `calc(100vh - 137px)`"
      :draggable="true"
      :props="{ label: 'title' }"
      @node-click="onNodeClick"
    ></zh-tree>
  </div>
</template>
<script lang="ts" setup name="orgTree">
import { Search } from '@element-plus/icons-vue';
//------------------接收传入参数(组件)-------------------

//------------------定义子组件---------------------------
const orgTreeRef=ref();
//------------------内部变量定义-------------------------
const { isTagsview } = storeToRefs($store.theme);
//------------------定义调用方法-------------------------
const emits = defineEmits([
	'node-click',
]);
const onNodeClick = (...args: any[]) => {
	emits('node-click', ...args);
};
const queryParam=ref<any>({permissionFlag:true});
//------------------初始化------------------------------
const dictParams = {
	dictFields: 'orgType',
};
const dictData = ref<any>({ nodeType: [], operating: [] });
$api.common.getBatchDict.post(dictParams).then((res: any) => {
	dictData.value = res.result;
});
const query=()=>{
  orgTreeRef.value.query();
}
const remove=(key)=>{
  orgTreeRef.value.remove(key);
}
const append=(node,key)=>{
  orgTreeRef.value.append(node,key);
}
const insertBefore=(node,key)=>{
  orgTreeRef.value.insertBefore(node,key);
}
onMounted(()=>{})
//------------设置给父组件调用的数据/方法(组件)-----------
defineExpose({ query,remove,append,insertBefore });
</script>
<style lang="scss" scoped>

</style>